package cn.tedu._05mvc;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Controller注解:
 * 1.标识当前类为控制器的类;
 * 2.用于接收客户端发送的请求;
 */
@Controller
public class UserController {
    @RequestMapping("/v1/user/login")
    @ResponseBody
    public String login(){
        return "恭喜你,登录成功";
    }
    /**
     * 注册功能:
     * 1.请求路径PATH /v1/user/reg
     * 2.请求方法:GET
     * 3.请求参数:username,password,nickname
     * 4.参数类型:查询字符串
     * 5.返回响应:恭喜你,注册成功;
     * http://localhost:8080/v1/user/reg?username=admin&password=123456&nickname=admin
     */
    @RequestMapping("/v1/user/reg")
    @ResponseBody
    public String reg(String username,String password,String nickname){
        System.out.println(username+":"+password+":"+nickname);
        return "恭喜你,注册成功";
    }
}
